<?php

/**使用是unzip("zip文件","目标文件夹，没有则创建",
* 1或0（如果是1，则复制子文件夹，0为不复制子文件夹）)
* 注意函数大小写。
**/
function unzip($source, $destination)
{ 
	$cmd = '"C:\\Program Files\\WinRAR\\winrar.exe" x '.$source.' '.$destination;
	return run_cmd($cmd);
}

function zip_f($source, $destination)
{ 
	$cmd = '"C:\\Program Files\\WinRAR\\winrar.exe" a -ep '.$source.' '.$destination;
	return run_cmd($cmd);
}

function mysql_backup($filename){
	$cmd = "\"D:\\xampp\\mysql\\bin\\mysqldump\" -uroot -p --default-character-set=utf8 projectdb > \"$filename\"";
	return run_cmd($cmd);
}

function run_cmd($cmd){
	echo $cmd;
	system($cmd);
	return 1;
}